package com.aurora.source.center.adapter;

import android.content.Context;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.TextView;

import com.aurora.source.R;
import com.aurora.source.adapter.ImgSeeAdapter;
import com.aurora.source.base.BaseRecyclerAdapter;
import com.aurora.source.base.CommonHolder;
import com.aurora.source.center.bean.OprationRecoredBean;

import butterknife.BindView;

/**
 * @author: ww
 * @description:流程记录适配器
 * @date: 2018/9/20
 */
public class FlowRecoredAdapter extends BaseRecyclerAdapter<OprationRecoredBean> {



    @Override
    public CommonHolder setViewHolder(ViewGroup parent) {
        return new MyHolder(parent.getContext(), parent, R.layout.item_flow_recored);
    }

    public class MyHolder extends CommonHolder<OprationRecoredBean> {

        @BindView(R.id.tv_title)
        EditText tvTitle;
        @BindView(R.id.tv_descrip)
        TextView tvDescrip;
        @BindView(R.id.rv_img)
        RecyclerView rvImg;
        @BindView(R.id.tv_oprat_person)
        TextView tvOpratPerson;
        @BindView(R.id.tv_time)
        TextView tvTime;
        Context context;
        public MyHolder(Context context, ViewGroup root, int layoutRes) {
            super(context, root, layoutRes);
            this.context = context;
        }

        @Override
        public void bindData(final OprationRecoredBean personFlowBean, final int positon) {
            ImgSeeAdapter imgSeeAdapter = new ImgSeeAdapter();
            imgSeeAdapter.addItems(personFlowBean.getImgList());
            rvImg.setLayoutManager(new GridLayoutManager(context,3));
            rvImg.setAdapter(imgSeeAdapter);

            tvTitle.setText(personFlowBean.getImplementedTitle());
            tvDescrip.setText(personFlowBean.getImplementedContent());
            tvOpratPerson.setText(personFlowBean.getImplementedUser());
            tvTime.setText(personFlowBean.getCreateTime());
        }
    }
}
